package com.pai4j.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 群聊操作类型枚举
 */
@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum GroupOperationTypeEnum {

    CREATE_GROUP(1, "创建群聊"),
    JOIN_GROUP(2, "加入群聊"),
    LEAVE_GROUP(3, "退出群聊"),
    KICK_MEMBER(4, "踢出成员"),
    APPOINT_ADMIN(5, "任命管理员"),
    REMOVE_ADMIN(6, "撤销管理员"),
    MUTE_MEMBER(7, "禁言成员"),
    UNMUTE_MEMBER(8, "解除禁言"),
    TRANSFER_OWNER(9, "转让群主"),
    DISSOLVE_GROUP(10, "解散群聊");

    private Integer type;
    private String typeName;

    /**
     * 根据类型值获取枚举
     */
    public static GroupOperationTypeEnum getByType(Integer type) {
        for (GroupOperationTypeEnum typeEnum : values()) {
            if (typeEnum.getType().equals(type)) {
                return typeEnum;
            }
        }
        return null;
    }
}
